package com.qm.console.controller.dto;

/**
 * 业务异常基类，所有业务异常都必须继承于此异常 定义异常时，需要先确定异常所属模块。 例如：无效用户可以定义为 [10010001]
 * 前四位数为系统模块编号，后4位为错误代码 ,唯一。
 *
 * @author yingjun
 */
public enum ResultEnum {

    // 通用
    SUCCESS(200, "OK"),
    FAILURE(100, "FAILURE"),
    PARA_ERR(99, "参数错误"),
    IP_NOT_IN_WHITE_LIST(98, "ip无访问权限"),
    EXCEL_PROCESSING(97, "excel正在生成, 请等10秒左右重新点击导出(期间请勿修改查询条件)下载excel..."),
    EXCEL_RESULT(96, "OK"),


    FAIL_AND_TRY_AGAIN(88, "操作失败， 请重试"),
    UPDATE_NEW_VERSION(2000, "版本过低，请升级到最新版本"),

    // im
    IM_GET_TOKEN_FAILED(101, "获取IM token失败"),
    IM_REGISTER_FAILED(102, "注册IM账号失败"),
    IM_ADD_CONTACTS_FAILED(103, "添加IM好友失败"),
    IM_DEL_CONTACTS_FAILED(104, "删除IM好友失败"),
    IM_FRIEND_UNEXIST(105, "要添加好友的用户不存在"),
    IM_SEND_MSG_FAILED(106, "消息发送失败"),
    IM_ALREADY_BE_FRIEND(107, "已经是好友"),
    IM_FRIEND_APPLY_UNEXIST(108, "好友申请不存在"),
    IM_NOT_FRIENDS(109, "非好友"),
    IM_OVER_USER_OWN_GROUP_NUM(110, "超过最大创建群数"),
    IM_CREATE_CHATGROUP_FAILED(111, "创建群组失败"),
    IM_CHATGROUP_UNEXIST(112, "群组不存在"),
    IM_PERMISSION_DENY(113, "没有群组操作权限"),
    IM_OWNER_LEAVE_CHATGROUP_NOT_ALLOWED(114, "不允许群主退群"),
    IM_RM_CHATGROUP_MEMBER_FAILED(115, "删除群成员失败"),
    IM_OVER_CHATGROUP_MEMBERS_LIMIT(116, "群组成员已满"),
    IM_INVITE_UNEXIST(117, "群组邀请不存在"),
    IM_IMVITE_EXPIRE(118, "群组邀请已过期"),
    IM_INVITE_ALREADY_PROCESSED(119, "群组邀请已处理"),
    IM_ADD_CHATGROUP_MEMBER_FAILED(120, "添加群成员失败"),
    IM_NOT_CHATGROUP_MEMBER(121, "非群成员"),
    IM_TRANSFER_CHATGROUP_FAILED(122, "转移群组失败"),
    IM_OVER_CHATGROUP_ADMINS_LIMIT(123, "群管理员已达上限"),
    IM_ALREADY_IN_CHATGROUP(124, "已是群组成员"),
    IM_ALREADY_APPLY_JOIN_IN_CHATGROUP(125, "已申请"),
    IM_CHATGROUP_APPLY_UNEXIST(126, "群组申请不存在"),
    IM_CHATGROUP_APPLY_ALREADY_PROCESSED(127, "群组申请已处理"),
    IM_ADD_CHATGROUP_ADMIN_FAILED(128, "添加群管理员失败"),
    IM_RM_CHATGROUP_ADMIN_FAILED(129, "删除群管理员失败"),
    IM_CHATGROUP_PRIVATE(130, "群组为私密群组"),
    IM_CREATE_CHATROOM_FAILED(131, "创建聊天室失败"),
    IM_CHATGROUP_BEING_PROCESSED(132, "您的俱乐部正在创建中"),

    // accout
    ACCOUNT_LOGIN_AUTH_FAILED(401, "登陆认证失败"),
    ACCOUNT_VERIFY_CODE_INVALID(200, "验证码错误"),
    ACCOUNT_GET_VERIFY_CODE_FAILED(201, "获取验证码过于频繁，请稍后再试"),
    ACCOUNT_GET_VERIFY_CODE_FREQUENTLY(202, "获取验证码过于频繁"),
    ACCOUNT_ONLY_SUPPORT_REBIND_PHONE(203, "仅支持换绑手机号"),
    ACCOUNT_PARA_ERR(204, "参数错误"),
    ACCOUNT_CANCEL_BIND_FAILD(205, "解绑失败"),
    ACCOUNT_PASSWORD_UNMATCH(230, "账号密码错误"),
    ACCOUNT_UNEXIST(233, "用户不存在"),
    ACCOUNT_ACCESS_WECHAT_FAILD(237, "访问微信失败"),
    ACCOUNT_FORTUNE_NOT_ENOUGH(240, "余额不足"),
    ACCOUNT_FORTUNE_IN_CHANGE(241, "财富变更中"),
    ACCOUNT_TOKEN_UNMATCH_ERROR_STATUS(242, "token unmatch"),
    ACCOUNT_PASSWORD_FORMAT_INVALID(243, "账号密码格式非法"),
    ACCOUNT_PHONE_FORMAT_INVALID(244, "手机号格式非法"),
    ACCOUNT_PHONE_ALREADY_BIND(247, "该手机号已被绑定"),
    ACCOUNT_ALREADY_BIND_OTHER_PHONE(248, "该账号已绑定手机号"),
    ACCOUNT_WECHAT_ALREADY_BIND(249, "该微信号已被绑定"),
    ACCOUNT_QQ_ALREADY_BIND(250, "该QQ号已被绑定"),
    ACCOUNT_ONLY_WECHAT_BIND(251, "账号只绑定了微信"),
    ACCOUNT_ONLY_QQ_BIND(252, "账号只绑定了QQ"),


    // shop
    SHOP_ORDER_NOT_EXIST(261, "订单不存在"),
    SHOP_GOODS_NOT_EXIST(262, "商品不存在"),

    WALLET_WITHDRAW_NOT_EXIST(270, "提现申请不存在"),
    PAY_TYPE_UNSUPPORT(272, "不支持的支付方式"),
    PAY_ORDER_TYPE_UNSUPPORT(273, "不支持的订单类型"),
    WALLET_WITHDRAW_MONEY_UNREAH_LIMIT(274, "单次最低需提现50元"),
    WALLET_WITHDRAW_NUM_OVER_LIMIT(275, "提现次数超过限制"),
    WALLET_WITHDRAW_UNFINISH(276, "当前还有未完成的提现"),
    WALLET_WITHDRAW_APP_INVALID(277, "当前还有未完成的提现"),
    WALLET_WITHDRAW_UPDATETIME_INVALID(279, "时间有误"),
    WALLET_WITHDRAW_MONEY_INVALID(280, "金额有误"),
    WALLET_PROFIT_TYPE_INVALID(281, "类型有误"),

    //sign
    SIGN_ERROR_STATUS(300, ""),
    SIGNED_TODAY_ERROR_STATUS(301, "今天已经签到过"),
    SIGN_DAY_NOT_MATCH_STATUS(302, "累计签到天数不足"),
    SIGN_REWARD_RECEIVED_ERROR_STATUS(303, "该阶段签到奖励已领取"),

    // voice room
    VOICEROOM_UNEXIST(310, "该房间不存在"),
    VOICEROOM_OFF_SEAT(311, "用户不在麦序上"),
    VOICEROOM_ON_SEAT(312, "用户已在麦序上"),
    VOICEROOM_SEAT_UNEXIST(313, "麦序位置不存在"),
    VOICEROOM_OUT_ROOM(314, "目标用户不在线"),
    VOICEROOM_SEAT_TAKEN(315, "麦序上已有用户"),
    VOICEROOM_PEMISSION_DENY(316, "没有操作权限"),
    VOICEROOM_NOT_ALLOWED_ENTER(317, "您已被禁止进入该房间"),
    VOICEROOM_PASSWORD_WRONG(318, "房间密码错误"),
    VOICEROOM_ALREADY_IN_ROOM(319, "您已在房间内"),
    VOICEROOM_PASSWD_LEN_EXCEED(320, "房间密码不能超过30个字符"),
    VOICEROOM_HOST_SEAT_UNTAKEN(321, "主持位为空时不可入座"),
    VOICEROOM_ADD_BLACK_FAILED(322, "添加到黑名单失败"),

    // gift
    GIFT_UNEXIST(330, "礼物不存在"),

    //task
    TASK_CANNOT_TAKE_REWARD(600, "当前任务无法领取"),

    //promote
    PROMOTE_MASTER_INVALID_ERROR_STATUS(280, ""),
    PROMOTE_ALREADY_BIND_MASTER_ERROR_STATUS(281, ""),
    PROMOTE_DEVICE_FORBIDEN_ERROR_STATUS(282, ""),
    PROMOTE_DEVICE_BIND_OVER_FIVE(283, ""),
    PROMOTE_USER_FORBIDDEN(284, ""),
    PRONOTE_ALREADY_BE_MASTER(285, ""),
    PROMOTE_USER_NOT_EXIT(286, "用户不存在"),
    PROMOTE_USER_INFO_WRONG(287, "用户信息有误或用户ID为空"),
    PROMOTE_VERISON_IGNORED(288, "version ignored"),
    PROMOTE_APPID_WRONG(289, "平台ID错误"),


    //me
    ME_REALINFO_UPDATE_FAILURE(730, "更新实名信息失败"),

    //hall
    HALL_NOT_XIST(700, "大厅不存在"),
    HALL_REGISTER_FAILED(701, "注册游戏账号失败"),
    PERMISSION_FAILED(702, "账号验证失败"),
    CHECK_OUT_FAILED(703, "金币带出失败"),
    CHECK_IN_FAILED(704, "金币带入失败"),
    GAME_NOT_EXIST(705, "玩家未进入游戏"),
    TOKEN_NOT_EXIST(706, "获取第三方token失败"),


    //trend
    TOPIC_NOT_EXIST(750, "话题不存在"),
    TREND_HAS_KEYWORD(751, "含有敏感词汇，发表失败"),
    TREND_IS_LIKED(752, "已经对这条动态点赞"),
    TREND_NOT_LIKED(753, "没有点赞，所以无法取消"),
    BLACK_USER_NOT_EXIT(754, "屏蔽的用户不存在"),
    USER_HAS_IN_BLACK(755, "该用户已经被屏蔽"),
    USER_IS_BANNED(756, "您因违规已被禁言，请联系客服解封"),
    BROADCAST_COUNT_ZERO(757, "暂无喊话次数，无法喊话"),
    BROADCAST_CANNOT(758, "正在发表喊话，请稍等"),
    SYSTEM_CONFIG_NOT_EXIST(759, "系统号不存在"),
    TREND_NOT_EXIST(760, "当前动态不存在"),


    //match
    MATCH_THIRD_FAILED(727, "向电玩城报名比赛失败"),
    MATCH_USER_EXIST(726, "已经报名过该比赛"),
    MATCH_ITEM_PULL_FAILED(725, "拉取比赛道具信息失败"),
    MATCH_PULL_FAILED(724, "拉取比赛信息失败"),
    MATCH_NOT_EXIST(723, "比赛不存在"),
    MATCH_USER_NOT_EXIST(722, "未报名该比赛"),
    MATCH_ENROLL_FAILED(721, "报名失败"),
    MATCH_CANNOT_ENROLL(720, "比赛无法报名"),

    //rank
    RANK_NO_RANKLIST(760, "没有此类型的排行榜"),

    //Cp
    CP_JOIN_FAILED(780, "组Cp失败"),
    CP_JOIN_ALREADY_IN_QUEUE(781, "已经再队列中了"),

    //Console config
    CONSOLE_ALREAGY_CONFIGURED(791, "已经配置过该产品"),
    CONSOLE_CONGIG_FAILED(790, "产品配置失败"),
    //block
    BLOCK_APPLICATION_EXIST(903,"该应用配置系统中已存在"),
    BLOCK_APP_PLAN_BE_USED(904,"该屏蔽方案已经被应用使用，不允许删除"),
    BLOCK_BUTTON_BE_USED(905,"该按钮已经配置在屏蔽方案中，不允许删除"),
    BLOCK_PAY_BE_USED(906,"该支付方式已经配置在屏蔽方案中，不允许删除"),


    CONVERT_ACCOUNT_ID_FAILED(1000, "账号转化失败"),





    //export
    EXCEL_EXPORT_ERROR(1000, "excel导出失败！"),


    //openplatform

    OPENPLATFORM_PARAM_ERROR(2000, "快手链接参数不符合"),

    POUND_EGG_EXPORT_MAX_ERROR(2102, "导出记录超出最大行数限制"),

    UNION_ID_HAS_BIND_USER(3004, "添加失败,该工会已经绑定过账号"),

    //Oss
    THIRD_OSS_GET_TOKEN_ERROR(4001, "oss获取上传token失败"),

    SYSTEM_CONFIG_ADD_UID_PARAM_ERROR(5001, "系统消息添加账号包含不合法字符"),


    // push message
    USER_MESSAGE_FAILED_TO_FIND(6001, "无法找到该消息记录"),
    USER_MESSAGE_DEL_ERROR_ALREADY_SENT(6002, "无法删除已发送或正在发送的消息"),
    USER_MESSAGE_UPDATE_ERROR(6003, "无法修改已发送或正在发送的消息"),

    // bx
    BX_JOB_INVALIDATE(7000, "job解析失败"),
    BX_JOB_NOT_EXISTS(7001, "job不存在?"),
    BX_JOB_GROUPER_INVALIDATE(70000, "不支持的filter"),
    BX_JOB_FIELD_INVALIDATE(70001, "field解析失败"),
    BX_JOB_DISPLAY_FIELD_INVALIDATE(70002, "display field解析失败"),
    BX_ATOM_VALIDATE_FAILED(700010, "field验证失败"),
    BX_ATOM_FIELD_NAME_CAN_NOT_CHANGE(700011, "不能修改字段名"),
    BX_JOB_FIELD_IN_USE(7002, "字段正在使用中, 无法修改或删除"),

    // es view
    ES_VIEW_INVALIDATE(8000, "请指定页面名..."),
    ES_VIEW_NOT_FOUND(8001, "未找到指定页面..."),

    // upload
    UPLOAD_FAILED_NOT_FOUND(9001, "文件上传失败, 未找到文件!"),
    UPLOAD_FAILED_IO_EXCEPTION(9002, "文件上传失败, 传输错误！"),
    UPLOAD_FAILED_UNZIP_FAILED(9003, "文件上传失败，zip文件解压错误")


    ;
    private int state;

    private String msg;

    ResultEnum(int state, String msg) {
        this.state = state;
        this.msg = msg;
    }

    public int getState() {
        return state;
    }

    public String getMsg() {
        return msg;
    }

    public static ResultEnum stateOf(int index) {
        for (ResultEnum state : values()) {
            if (state.getState() == index) {
                return state;
            }
        }
        return null;
    }

    public void setState(int state) {
        this.state = state;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }}
